/* GUI CONVERTED from ecwind01.i (converter v1.76) Wed Apr  3 17:36:38 2002 */
/* ecwind01.i - Scrolling window include file                                 */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.5.1.5 $                                                       */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 7.4      LAST MODIFIED: 08/15/93   BY: pma *H013*                */
/* REVISION: 7.3      LAST MODIFIED: 12/16/95   BY: jzs *G1GS*                */
/* REVISION: 7.4      LAST MODIFIED: 01/18/96   BY: bcm *H0HZ*                */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 07/11/00   BY: *N0FJ* Mudit Mehta        */
/* REVISION: 9.1      LAST MODIFIED: 08/14/00   BY: *N0KW* Jacolyn Neder      */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.5.1.5 $    BY: Jean Miller           DATE: 04/03/02  ECO: *P053*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/*                                                             */
/* SCROLLS ON 2 INDEXES PIVOTING BETWEEN THEM                  */
/* BASED ON WINDQAD.I                                          */
/*                                                             */
/*    {&file} = file name                                      */
/*    {&display} = list of fields to display in frame.         */
/*                 Must include indexed fields 1 and 2.        */
/*    {&index-fld1} = indexed field #1 name                              */
/*    {&use-index1} = indexed field #1 use-index e.g. "use-index pt_part"*/
/*    {&index-fld2} = indexed field #2 name                              */
/*    {&use-index2} = indexed field #2 use-index e.g. "use-index pt_desc"*/
/*    {&frametitle} = frame title                              */
/*    {&where}      = "where xxx = yyy"                        */
/*    {&and}        = "and   xxx = yyy"                        */
/*    {&return}     = "yes/no"   return a value to frame-value */
/*    {&tag}        = Field to toggle on select                */
/*    {&width}      = width of frame                           */
/*    {&help}       = yes/no (is F2 active)                    */
/*    {&helpfile}   = file to look up value of on F2           */
/*    {&helpfield}  = field in helpfile that = display field   */
/*    {&helpdisp}   = the help data to be displayed            */
/*    {&helpframe}  = the frame to display the help data in    */
/*    {&helpphrase} = other frame phrase values                */

/* Assumptions:                                                */
/* 1. Indexed fields are the highest order fields              */
/*    in their indexes                                         */
/*                                                             */

FORM /*GUI*/ 
   {&display}
with frame w centered row window_row scroll 1 window_down down overlay
attr-space title color normal {&frametitle} {&width} BGCOLOR 8 /*GUI*/.


setFrameLabels(frame w:handle).

FORM /*GUI*/  with frame {&helpframe} {&helpphrase} THREE-D /*GUI*/.


setFrameLabels(frame {&helpframe}:handle).

assign window_recid   = ?.

if {&return} then
   frame_val_save = frame-value.

hide message no-pause.
status input off.
status default stline[6].

find first {&file} {&where} no-lock no-error.

if not available {&file} then do:

   if "{&file}" = "cdwkfl" then do:
      /* No comments found matching Reference/Type/Language criteria */
      {pxmsg.i &MSGNUM=5693 &ERRORLEVEL=2}
   end.
   else do:
      /* There are no records in file # */
      {pxmsg.i &MSGNUM = 2767 &MSGARG1 = ""{&file}""}
      pause.
   end.

   next.

end.

if {&return}  then
   partial_ixval = "".
else
   partial_ixval = "".

partial_ixlen = length(partial_ixval).

repeat while partial_ixlen > 0 and
             substring(partial_ixval,partial_ixlen,1) = " ":
   partial_ixlen = partial_ixlen - 1.
end.

partial_ixval = substring(partial_ixval,1,partial_ixlen).

field_nbr = 1.

do with frame w:

   clear frame w all no-pause.
   ixlastline = 0.

   find first {&file} where {&index-fld1} >= partial_ixval
      {&and}
      {&use-index1}
   no-lock no-error.

   if not available {&file} then
   find last {&file} where {&index-fld1} <= partial_ixval {&and} {&use-index1}
   no-lock no-error.

   repeat while available {&file} with frame w:

      ixlastline = ixlastline + 1.
      ix1array[ixlastline] = {&index-fld1}.
      ix2array[ixlastline] = {&index-fld2}.
      recidarray[ixlastline] = recid({&file}).

      display {&display}.

      if frame-line = frame-down then leave.
      find next {&file} {&where} {&use-index1}
      no-lock no-error.

      if available {&file} then down 1.

   end.

   partial_ixval = substring(ix1array[1],1,partial_ixlen).
   up ixlastline - 1.
   color prompt-for messages {&index-fld1}.

end.

prompt-for {&index-fld1} with frame w
editing: /* GET A KEYSTROKE */
   do i = 1 to partial_ixlen:
      apply keycode("CURSOR-RIGHT").
   end.
   readkey.
   leave.
end. /* END GET A KEYSTROKE */

/* 32 TO 256 IS DISPLAYABLE ASCII CHARACTER RANGE */
repeat while lastkey = 8
   or (lastkey >= 32 and lastkey <= 255)
   or lastkey = keycode("CURSOR-UP")
   or lastkey = keycode("CURSOR-DOWN")
   or lastkey = keycode("F9")
   or lastkey = keycode("F10")
   or lastkey = keycode("CURSOR-LEFT")
   or lastkey = keycode("CURSOR-RIGHT")
   or lastkey = keycode("RETURN")
   or lastkey = keycode("F8")
   or keyfunction(lastkey) = "page-down"
   or lastkey = 18
   or lastkey = keycode("F7")
   or keyfunction(lastkey) = "page-up"
   or lastkey = 26
   or keyfunction(lastkey) = "HELP"
   or lastkey = keycode("CTRL-W")
with frame w:
/*GUI*/ if global-beam-me-up then undo, leave.


   if field_nbr = 1 then do:

      if lastkey = 8 or lastkey = keycode("CURSOR-LEFT") then do:
         if partial_ixlen > 0 then partial_ixlen = partial_ixlen - 1.
         partial_ixval = substring(partial_ixval,1,partial_ixlen).
      end.

      else
      if lastkey = keycode("CURSOR-RIGHT") then do:
         if length(ix1array[frame-line]) > partial_ixlen then do:
            partial_ixlen = partial_ixlen + 1.
            partial_ixval = substring(ix1array[frame-line],1,partial_ixlen).
         end.
      end.

      else
      if lastkey >= 32 and lastkey <= 255 then do:

         partial_ixval = partial_ixval + chr(lastkey).
         partial_ixlen = partial_ixlen + 1.

         if partial_ixval > ix1array[ixlastline]
         or partial_ixval < ix1array[1]
         then do:

            find first {&file} where {&index-fld1} >= partial_ixval
               {&and} {&use-index1}
            no-lock no-error.

            if available {&file} then do:

               if {&index-fld1} = ix1array[1] then do:
                  up frame-line - 1.
                  color prompt-for messages {&index-fld1}.
                  partial_ixval = substring(ix1array[1],1,partial_ixlen).
               end.

               else do:

                  clear frame w all no-pause.

                  ixlastline = 0.

                  find first {&file} where {&index-fld1} >= partial_ixval
                     {&and} {&use-index1}
                  no-lock no-error.

                  repeat while available {&file} with frame w:

                     ixlastline = ixlastline + 1.
                     ix1array[ixlastline] = {&index-fld1}.
                     ix2array[ixlastline] = {&index-fld2}.
                     recidarray[ixlastline] = recid({&file}).

                     display {&display}.

                     if frame-line = frame-down then leave.

                     find next {&file} {&where} {&use-index1}
                     no-lock  no-error.
                     if available {&file} then down 1.

                  end.

                  partial_ixval = substring(ix1array[1],1,partial_ixlen).
                  up ixlastline - 1.
                  color prompt-for messages {&index-fld1}.

               end.

            end.

            else do:
               if partial_ixlen > 1 then partial_ixlen = partial_ixlen - 1.
               partial_ixval = substring(partial_ixval,1,partial_ixlen).
            end.

         end.

         else do:
            /* LOCATE FIRST SCREEN ELEMENT >= partial_ixval */
            i = 1.
            do while ix1array[i] < partial_ixval:
               i = i + 1.
            end.
            up frame-line - i.  /* NEGATIVE EXPR HERE IS down */
            color prompt-for messages {&index-fld1}.
            partial_ixval = substring(ix1array[i],1,partial_ixlen).
         end.

      end.

      else
      if lastkey = keycode("CURSOR-UP") or
         lastkey = keycode("F9")
      then do:

         if frame-line = 1 then do:

            find {&file} where recid({&file}) = recidarray[1]
            no-lock no-error.

            find prev {&file} {&where} {&use-index1}
            no-lock no-error.

            if available {&file} then do:

               clear frame w all no-pause.

               ixlastline = 0.

               repeat while available {&file} with frame w:

                  ixlastline             = ixlastline + 1.
                  ix1array[ixlastline]   = {&index-fld1}.
                  ix2array[ixlastline]   = {&index-fld2}.
                  recidarray[ixlastline] = recid({&file}).

                  display {&display}.

                  if frame-line = frame-down then
                     leave.

                  find next {&file} {&where} {&use-index1}
                  no-lock no-error.

                  if available {&file} then
                     down 1.
               end.

               partial_ixval =  substring(ix1array[1],1,partial_ixlen).

               up ixlastline - 1.

               color prompt-for messages {&index-fld1}.

            end.

            else do.
               {pxmsg.i &MSGNUM=21 &ERRORLEVEL=2} /* "Beginning of file"*/
            end.

         end.

         else do:
            up 1.
            color prompt-for messages {&index-fld1}.
            partial_ixval = substring(ix1array[frame-line],1,partial_ixlen).
         end.

      end.

      /* Page Backward */
      else if lastkey = keycode("F7")
      or keyfunction(lastkey) = "page-up"
      or lastkey = 18
      then do:

         find {&file} where recid({&file}) = recidarray[1] no-lock no-error.
         find prev {&file} {&where} {&use-index1} no-lock no-error.

         if available {&file} then do:

            do i = 1 to frame-down - 2 while available {&file}:
               find prev {&file} {&where} {&use-index1} no-lock no-error.
            end.

            if not available {&file} then
            find first {&file} {&where} {&use-index1}
            no-lock no-error.

            clear frame w all no-pause.
            ixlastline = 0.

            repeat while available {&file} with frame w:

               ixlastline              = ixlastline + 1.
               ix1array[ixlastline]    = {&index-fld1}.
               ix2array[ixlastline]    = {&index-fld2}.
               recidarray[ixlastline]  = recid({&file}).

               display {&display}.

               if frame-line = frame-down then leave.

               find next {&file} {&where} {&use-index1}
               no-lock no-error.

               if available {&file} then down 1.

            end.

            partial_ixval =  substring(ix1array[1] + spcs,1,partial_ixlen).

            up (ixlastline - 1).
            color prompt-for messages {&index-fld1}.

         end.

      end.

      /* Page Forward */
      else
      if lastkey = keycode("F8")
      or keyfunction(lastkey) = "page-down"
      or lastkey = 26
      then do:

         find {&file} where recid({&file}) = recidarray[ixlastline]
         no-lock no-error.

         clear frame w all no-pause.
         ixlastline = 0.

         repeat while available {&file} with frame w:

            ixlastline             = ixlastline + 1.
            ix1array[ixlastline]   = {&index-fld1}.
            ix2array[ixlastline]   = {&index-fld2}.
            recidarray[ixlastline] = recid({&file}).

            display {&display}.

            if frame-line = frame-down then leave.
            find next {&file} {&where} {&use-index1} no-lock no-error.

            if available {&file} then down 1.

         end.

         partial_ixval =  substring(ix1array[1] + spcs,1,partial_ixlen).

         up (ixlastline - 1).
         color prompt-for messages {&index-fld1}.

      end.

      if lastkey = keycode("CURSOR-DOWN") or
         lastkey = keycode("RETURN")      or
         lastkey = keycode("F10")
      then do:

         if lastkey = keycode("RETURN") then do:
            find {&file} where recid({&file}) = recidarray[frame-line(w)]
            no-error.
            if  available {&file} then do:
               if {&tag} = "*" then
                  {&tag} = "".
               else
                  {&tag} = "*".
               display {&tag}.
               release {&file}.
            end.
         end.

         if frame-line = ixlastline then do:

            find {&file} where recid({&file}) = recidarray[ixlastline]
            no-lock no-error.

            find next {&file} {&where}
               {&use-index1}
            no-lock no-error.

            if available {&file} then do:
               pause 0.
               down 1.
               display {&display}.
               color prompt-for messages {&index-fld1}.

               do i = 1 to ixlastline:
                  ix1array[i] = ix1array[i + 1].
                  ix2array[i] = ix2array[i + 1].
                  recidarray[i] = recidarray[i + 1].
               end.

               ix1array[ixlastline] = {&index-fld1}.
               ix2array[ixlastline] = {&index-fld2}.
               recidarray[ixlastline] = recid({&file}).
               partial_ixval = substring(ix1array[ixlastline],1,partial_ixlen).

            end.

            else do.
               {pxmsg.i &MSGNUM=20 &ERRORLEVEL=2} /* "End of file"*/
            end.

         end.

         else do:
            down 1.
            color prompt-for messages {&index-fld1}.
            partial_ixval = substring(ix1array[frame-line],1,partial_ixlen).
         end.

      end.

      else if lastkey = 9 or lastkey = 21 then do:
         /* PIVOT SCREEN TO SECOND INDEXED FIELD */
         field_nbr = field_nbr + 1.
         i = frame-line.
         j = 1.

         find {&file} where recid({&file}) = recidarray[i]
         no-lock no-error.

         do while i > 1 and available {&file}:
            find prev {&file} {&where} {&use-index2}  no-lock no-error.
            i = i - 1.
            if available {&file} then j = j + 1.
         end.

         if not available {&file} then
         find first {&file} {&where}
            {&use-index2}
         no-lock no-error.

         do with frame w: /* BUILD A FRESH SCREEN */
            clear frame w all no-pause.
            ixlastline = 0.

            repeat while available {&file} with frame w:
               ixlastline             = ixlastline + 1.
               ix1array[ixlastline]   = {&index-fld1}.
               ix2array[ixlastline]   = {&index-fld2}.
               recidarray[ixlastline] = recid({&file}).
               display {&display}.
               if frame-line = frame-down then
                  leave.
               find next {&file} {&where}
                  {&use-index2}
               no-lock no-error.
               if available {&file} then down 1.
            end.

            partial_ixval = substring(ix2array[j],1,partial_ixlen).
            up ixlastline - j.
            color prompt-for messages {&index-fld2}.

         end. /* END BUILD A FRESH SCREEN */
      end.

      else
      if {&help} and (lastkey = keycode("HELP")
      /*V8+*/
      )
      then
      repeat with frame {&helpframe} {&helpphrase}:

         find first {&helpfile} where {&helpfield} = frame-value
         no-lock no-error.

         if available {&helpfile} then
         repeat with frame {&helpframe} {&helpphrase}:
            display {&helpdisp}.
            pause.
            leave.
         end.
         hide frame {&helpframe} no-pause.
         readkey pause 0.
         leave.
      end.

      else apply lastkey.

   end.

   /* BROWSE ON THE SECOND FIELD */
   else do:

      if lastkey = 8 or lastkey = keycode("CURSOR-LEFT") then do:
         if partial_ixlen > 0 then partial_ixlen = partial_ixlen - 1.
         partial_ixval = substring(partial_ixval,1,partial_ixlen).
      end.

      else if lastkey = keycode("CURSOR-RIGHT") then do:
         if length(ix2array[frame-line]) > partial_ixlen then do:
            partial_ixlen = partial_ixlen + 1.
            partial_ixval = substring(ix2array[frame-line],1,partial_ixlen).
         end.
      end.

      else if lastkey >= 32 and lastkey <= 256 then do:
         partial_ixval = partial_ixval + chr(lastkey).
         partial_ixlen = partial_ixlen + 1.
         if partial_ixval > ix2array[ixlastline]
            or partial_ixval < ix2array[1]
         then do:
            find first {&file} where {&index-fld2} >= partial_ixval
               {&and}
               {&use-index2}
            no-lock no-error.
            if available {&file} then do:
               if {&index-fld2} = ix2array[1] then do:
                  up frame-line - 1.
                  color prompt-for messages {&index-fld2}.
                  partial_ixval = substring(ix2array[1],1,partial_ixlen).
               end.

               else do:

                  clear frame w all no-pause.
                  ixlastline = 0.

                  find first {&file} where {&index-fld2} >= partial_ixval
                     {&and}
                     {&use-index2}
                  no-lock no-error.

                  repeat while available {&file} with frame w:

                     ixlastline             = ixlastline + 1.
                     ix1array[ixlastline]   = {&index-fld1}.
                     ix2array[ixlastline]   = {&index-fld2}.
                     recidarray[ixlastline] = recid({&file}).

                     display {&display}.

                     if frame-line = frame-down then
                        leave.

                     find next {&file} {&where}
                        {&use-index2}
                     no-lock no-error.

                     if available {&file} then
                        down 1.

                  end.

                  partial_ixval = substring(ix2array[1],1,partial_ixlen).
                  up ixlastline - 1.
                  color prompt-for messages {&index-fld2}.

               end.

            end.

            else do:
               if partial_ixlen > 1 then partial_ixlen = partial_ixlen - 1.
               partial_ixval = substring(partial_ixval,1,partial_ixlen).
            end.

         end.

         else do:
            /* LOCATE FIRST SCREEN ELEMENT >= partial_ixval */
            i = 1.
            do while ix2array[i] < partial_ixval:
               i = i + 1.
            end.
            up frame-line - i.  /* NEGATIVE EXPR HERE IS down */
            color prompt-for messages {&index-fld2}.
            partial_ixval = substring(ix2array[i],1,partial_ixlen).
         end.

      end.

      else
      if lastkey = keycode("CURSOR-UP") or lastkey = keycode("F9")
      then do:

         if frame-line = 1 then do:

            find {&file} where recid({&file}) = recidarray[1]
            no-lock no-error.

            find prev {&file} {&where}
               {&use-index2}
            no-lock no-error.

            if available {&file} then do:

               clear frame w all no-pause.
               ixlastline = 0.

               repeat while available {&file} with frame w:

                  ixlastline             = ixlastline + 1.
                  ix1array[ixlastline]   = {&index-fld1}.
                  ix2array[ixlastline]   = {&index-fld2}.
                  recidarray[ixlastline] = recid({&file}).

                  display {&display}.

                  if frame-line = frame-down then
                     leave.

                  find next {&file} {&where}
                     {&use-index2}
                  no-lock no-error.

                  if available {&file} then
                     down 1.

               end.

               partial_ixval = substring(ix2array[1],1,partial_ixlen).
               up ixlastline - 1.
               color prompt-for messages {&index-fld2}.

            end.

            else do.
               {pxmsg.i &MSGNUM=21 &ERRORLEVEL=2} /* "Beginning of file"*/
            end.

         end.

         else do:
            up 1.
            color prompt-for messages {&index-fld2}.
            partial_ixval = substring(ix2array[frame-line],1,partial_ixlen).
         end.

      end.

      else
      if lastkey = keycode("F7")
      or keyfunction(lastkey) = "page-down"
      or lastkey = 18 then do:

         /* PAGE BACKWARD */
         find {&file} where recid({&file}) = recidarray[1] no-lock no-error.

         find prev {&file} {&where} {&use-index2} no-lock no-error.

         if available {&file} then do:

            do i = 1 to frame-down - 2 while available {&file}:
               find prev {&file} {&where} {&use-index2} no-lock no-error.
            end.

            if not available {&file} then
            find first {&file} {&where} {&use-index2}
            no-lock no-error.

            clear frame w all no-pause.
            ixlastline = 0.

            repeat while available {&file} with frame w:
               ixlastline              = ixlastline + 1.
               ix1array[ixlastline]    = {&index-fld1}.
               ix2array[ixlastline]    = {&index-fld2}.
               recidarray[ixlastline]  = recid({&file}).
               display {&display}.
               if frame-line = frame-down then leave.
               find next {&file}
                  {&where} {&use-index2} no-lock no-error.
               if available {&file} then down 1.
            end.

            partial_ixval =  substring(ix2array[1] + spcs,1,partial_ixlen).
            up (ixlastline - 1) / 2.

            color prompt-for messages {&index-fld2}.

         end.

      end.

      else
      if lastkey = keycode("F8")
      or keyfunction(lastkey) = "page-up"
      or lastkey = 26 then do:

         /* PAGE FORWARD */
         find {&file} where recid({&file}) = recidarray[ixlastline]
         no-lock no-error.
         clear frame w all no-pause.
         ixlastline = 0.

         repeat while available {&file} with frame w:
            ixlastline             = ixlastline + 1.
            ix1array[ixlastline]   = {&index-fld1}.
            ix2array[ixlastline]   = {&index-fld2}.
            recidarray[ixlastline] = recid({&file}).
            display {&display}.
            if frame-line = frame-down then leave.
            find next {&file} {&where} {&use-index2} no-lock no-error.
            if available {&file} then down 1.
         end.

         partial_ixval =  substring(ix2array[1] + spcs,1,partial_ixlen).
         up (ixlastline - 1) / 2.
         color prompt-for messages {&index-fld2}.

      end.

      if lastkey = keycode("CURSOR-DOWN") or
         lastkey = keycode("RETURN")      or
         lastkey = keycode("F10")
      then do:

         if lastkey = keycode("RETURN") then do:

            find {&file} where recid({&file}) =  recidarray[frame-line(w)]
            no-error.

            if  available {&file} then do:
               if {&tag} = "*" then
                  {&tag} = "".
               else
                  {&tag} = "*".
               display {&tag}.
               release {&file}.
            end.

         end.

         if frame-line = ixlastline then do:
            find {&file} where recid({&file}) = recidarray[ixlastline]
            no-lock no-error.

            find next {&file} {&where} {&use-index2}
            no-lock no-error.

            if available {&file} then do:
               pause 0.
               down 1.
               display {&display}.
               color prompt-for messages {&index-fld2}.

               do i = 1 to ixlastline:
                  ix1array[i] = ix1array[i + 1].
                  ix2array[i] = ix2array[i + 1].
                  recidarray[i] = recidarray[i + 1].
               end.

               ix1array[ixlastline] = {&index-fld1}.
               ix2array[ixlastline] = {&index-fld2}.
               recidarray[ixlastline] = recid({&file}).
               partial_ixval = substring(ix2array[ixlastline],1,partial_ixlen).
            end.

            else do.
               {pxmsg.i &MSGNUM=20 &ERRORLEVEL=2} /* "End of file"*/
            end.

         end.

         else do:
            down 1.
            color prompt-for messages {&index-fld2}.
            partial_ixval = substring(ix2array[frame-line],1,partial_ixlen).
         end.

      end.

      else
      if lastkey = 9 or lastkey = 21 then do:
         /* PIVOT SCREEN TO FIRST INDEXED FIELD */
         field_nbr = field_nbr - 1.
         i = frame-line.
         j = 1.

         find {&file} where recid({&file}) = recidarray[i]
         no-lock no-error.

         do while i > 1 and available {&file}:

            find prev {&file} {&where} {&use-index1}
            no-lock no-error.
            i = i - 1.

            if available {&file} then
               j = j + 1.

         end.

         if not available {&file} then
         find first {&file} {&where} {&use-index1}
         no-lock no-error.

         clear frame w all no-pause.
         ixlastline = 0.

         repeat while available {&file} with frame w:

            ixlastline = ixlastline + 1.
            ix1array[ixlastline] = {&index-fld1}.
            ix2array[ixlastline] = {&index-fld2}.
            recidarray[ixlastline] = recid({&file}).

            display {&display}.

            if frame-line = frame-down then
               leave.

            find next {&file} {&where} {&use-index1}
            no-lock no-error.

            if available {&file} then
               down 1.

         end.

         partial_ixval = substring(ix1array[j],1,partial_ixlen).
         up ixlastline - j.
         color prompt-for messages {&index-fld1}.

      end.

      else
      if {&help} and (lastkey = keycode("HELP")
      /*V8+*/
      )
      then
      repeat with frame {&helpframe} {&helpphrase}:

         find first {&helpfile} where {&helpfield} = frame-value
         no-lock no-error.

         if available {&helpfile} then
         repeat with frame {&helpframe} {&helpphrase}:
             display {&helpdisp}.
             pause.
             leave.
         end.

         hide frame {&helpframe} no-pause.
         readkey pause 0.
         leave.

      end.

      else apply lastkey.

   end.

   if field_nbr = 1 then do:

      prompt-for {&index-fld1} with frame w
      editing: /* GET A KEYSTROKE */

         do i = 1 to partial_ixlen:
            apply keycode("CURSOR-RIGHT").
         end.

         readkey.
         leave.

      end. /* END GET A KEYSTROKE */

      assign wtemp3 = string(input {&index-fld1}).  /* to stop compile warning*/

   end.

   else do:

      prompt-for {&index-fld2} with frame w
      editing: /* GET A KEYSTROKE */

         do i = 1 to partial_ixlen:
            apply keycode("CURSOR-RIGHT").
         end.

         readkey.
         leave.

      end. /* END GET A KEYSTROKE */

      assign wtemp3 = string(input {&index-fld2}).  /* to stop compile warning*/

   end.

end.
/*GUI*/ if global-beam-me-up then undo, leave.


i = frame-line(w).

hide frame w.
